﻿#region "Copyright (C) Lenny Granovsky. 2005-2013"
//This program is free software distribute under the terms of the GNU General Public License as published by
//the Free Software Foundation. Please read AssemblyInfo.cs file for more information.
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Web.Enhancements.Rest.Templates
{
    /// <summary>
    /// Interface that class must implement to become HTML Template.
    /// </summary>
    /// <typeparam name="TDataSource">Generic object type of DataSource for the HTML Template.</typeparam>
    public interface IHtmlTemplate<TDataSource>
    {
        /// <summary>
        /// Gets or sets data source for the HTML Template.
        /// </summary>
        TDataSource DataSource { get; set; }
        /// <summary>
        /// Gets collection of temporary items used to pass additional data to HTML template.
        /// </summary>
        Dictionary<string, object> TempData { get; set; }
        /// <summary>
        /// Method renders HTML template with given data source and writes result into an HtmlTextWriter.
        /// </summary>
        /// <param name="dataSource">Data source for the template.</param>
        /// <param name="writer">HtmlTextWriter object to write rendered result to.</param>
        void RenderTemplate(TDataSource dataSource, HtmlTextWriter writer);
        /// <summary>
        /// Method renders HTML template and writes result into an HtmlTextWriter.
        /// </summary>
        /// <param name="writer">HtmlTextWriter object to write rendered result to.</param>
        void RenderTemplate(HtmlTextWriter writer);
    }
}
